<me:UIKS05 x:Class="WPFExcelReport.TKSTAGZUO"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL"  
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
                    xmlns:LS="clr-namespace:WPFExcelReport;assembly=TLIEFDAT"   
                    xmlns:DR="clr-namespace:WPFExcelReport;assembly=TDRAUFTR"  
                    xmlns:KS="clr-namespace:WPFExcelReport;assembly=TKSTSTELL" 
                    xmlns:APK="clr-namespace:WPFExcelReport;assembly=TAPKOPF" 
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    xmlns:WH="clr-namespace:WPFExcelReport;assembly=TLAGPL"  
                    xmlns:WF="clr-namespace:WPFExcelReport;assembly=TICC_WFEVENTS"  
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIKS05.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>      
        <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTBoolToVisibilityConverter  x:Key="nbv"/>
        <ucd:NOTConverter x:Key="not"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
        <ucd:SDKEYCONV x:Key="sd"/>
    </me:UIKS05.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition> 
        </Grid.RowDefinitions> 
        <StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"  >
            <StackPanel  VerticalAlignment="Top"  > 
                <WrapPanel> 
                    <Grid Margin="10,0,0,0" VerticalAlignment="Top" 
                      IsEnabled="{Binding IsCanDelete,ElementName=TV}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24" >
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                            </Button.Background>
                        </Button>
                    </Grid>
                    <Grid Margin="10,0,0,0" VerticalAlignment="Top" 
                          Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource nbv}}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Button  Click="EditCommand" Width="24" Height="20">
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                            </Button.Background>
                        </Button>
                    </Grid>
                    <Grid Margin="10,0,0,0" VerticalAlignment="Top"  
                      Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" >
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                            </Button.Background>
                        </Button>
                    </Grid>
                    <Grid Margin="10,0,0,0" VerticalAlignment="Top"  >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock FontSize="16"  Text="{Binding Source={Localization:Translate Word=成本中心}}"/>
                        <ex:TXT72 Grid.Column="1" FontSize="16" MaxLength="2"    
                              CharacterCasing="Upper" Text="{Binding KRS,ElementName=TV}" Width="30" />
                        <ex:TXT72 Grid.Column="2" FontSize="16" Margin="5,0,0,0" MaxLength="4"  
                              Text="{Binding LFD,ElementName=TV}" KeyUp="Query_KeyUp" Width="90" />
                    </Grid>
                    <Grid Margin="10,0,0,0"  VerticalAlignment="Top">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Button Grid.Column="0"  Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" >
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                            </Button.Background>
                        </Button>
                        <TextBlock Grid.Column="2" FontSize="16" Text="{Binding Source={Localization:Translate Word=查询}}"/>
                    </Grid>
                    <WF:TBTNEXE DLL="TAPKOPF" CMD="AP02" STWNW="MainWindow" INFO="工艺条件管理" IsInfo="True"
                                KEY="{Binding KEY,ElementName=TV}"/>
                </WrapPanel> 
                <WrapPanel>
                    <Button Grid.Column="0"  Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24"
                            IsEnabled="{Binding IsCanNew,ElementName=TV}"
                            >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                    <KS:TSKS03 Grid.Column="1"  
                                  IsEdit="True"
                                   KEY="{Binding Path=KST,ElementName=TV}" /> 
                    <WrapPanel Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}"> 
                        <SD:K0231 IsEdit="True"  KEY="{Binding POS,ElementName=TV}"   />
                        <Button Grid.Column="0"  Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                            </Button.Background>
                        </Button>
                    </WrapPanel>
                </WrapPanel>
            </StackPanel>
            <me:TUIKS05 LO="{Binding LO,ElementName=TV}"
                         LB="{Binding LB,ElementName=TV}"
                         LP="{Binding LP,ElementName=TV}"
                        IsEdit="{Binding IsEdit,ElementName=TV}"
                        IsSaved="{Binding IsSaved,ElementName=TV}"
                         LIEFNR="{Binding LIEFNR,ElementName=TV}"
                        />
        </StackPanel>
        <DataGrid  Grid.Row="2"  Grid.Column="0" 
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   IsReadOnly="True"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"     
                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True" 
                   x:Name="dlgMaster"  
                   RowDetailsVisibilityMode="Visible"    >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding KSZKSTKRS}" Width="Auto"/>
                <DataGridTextColumn Binding="{Binding KSZKST}" Header="{Binding Source={Localization:Translate Word=成本中心}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding KSZAGANG,Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=操做}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding KSZAGANG,Converter={StaticResource sd},ConverterParameter=0231}" Header="{Binding Source={Localization:Translate Word=说明}}" Width="Auto"/>
                <DataGridTextColumn Binding="{Binding KSZLO}" Header="{Binding Source={Localization:Translate Word=LO}}" Width="Auto"/>
                <DataGridTextColumn Binding="{Binding KSZLB}" Header="{Binding Source={Localization:Translate Word=LB}}" Width="Auto"/>
                <DataGridTextColumn Binding="{Binding KSZLP}" Header="{Binding Source={Localization:Translate Word=LP}}" Width="Auto"/>
                <DataGridTextColumn Binding="{Binding KSZLIEFNR}" Header="{Binding Source={Localization:Translate Word=供应商}}" Width="Auto"/>                
            </DataGrid.Columns>
        </DataGrid> 
    </Grid>
</me:UIKS05>
